home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / OCEMail.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  49KB  |  1,558 lines

  1. /*
  2.      File:        OCEMail.h
  3.  
  4.      Contains:    Apple Open Collaboration Environment OCEMail Interfaces.
  5.  
  6.      Version:    Technology:    AOCE Toolbox 1.02
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __OCEMAIL__
  19. #define __OCEMAIL__
  20.  
  21. #ifndef __FILES__
  22. #include <Files.h>
  23. #endif
  24. #ifndef __MEMORY__
  25. #include <Memory.h>
  26. #endif
  27. #ifndef __TEXTEDIT__
  28. #include <TextEdit.h>
  29. #endif
  30. #ifndef __TYPES__
  31. #include <Types.h>
  32. #endif
  33. #ifndef __DIGITALSIGNATURE__
  34. #include <DigitalSignature.h>
  35. #endif
  36. #ifndef __OCE__
  37. #include <OCE.h>
  38. #endif
  39. #ifndef __OCEAUTHDIR__
  40. #include <OCEAuthDir.h>
  41. #endif
  42. #ifndef __OCEMESSAGING__
  43. #include <OCEMessaging.h>
  44. #endif
  45.  
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT_SUPPORTED
  51. #pragma import on
  52. #endif
  53.  
  54. #if PRAGMA_ALIGN_SUPPORTED
  55. #pragma options align=mac68k
  56. #endif
  57.  
  58. #if FOR_SYSTEM7_ONLY
  59. /**************************************************************************************/
  60. /* Common Definitions */
  61. /**************************************************************************************/
  62. /* reference to a new or open letter or message */
  63. typedef long MailMsgRef;
  64. /* reference to an open msam queue */
  65. typedef long MSAMQueueRef;
  66. /* identifies slots managed by a PMSAM */
  67. typedef unsigned short MSAMSlotID;
  68. /* reference to an active mailbox */
  69. typedef long MailboxRef;
  70. /* identifies slots within a mailbox */
  71. typedef unsigned short MailSlotID;
  72. /* identifies a letter in a mailbox */
  73. struct MailSeqNum {
  74.     MailSlotID                         slotID;
  75.     long                             seqNum;
  76. };
  77. typedef struct MailSeqNum MailSeqNum;
  78.  
  79. /*
  80.  A MailBuffer is used to describe a buffer used for an IO operation.
  81. The location of the buffer is pointed to by 'buffer'. 
  82. When reading, the size of the buffer is 'bufferSize' 
  83. and the size of data actually read is 'dataSize'.
  84. When writing, the size of data to be written is 'bufferSize' 
  85. and the size of data actually written is 'dataSize'.
  86. */
  87. struct MailBuffer {
  88.     long                             bufferSize;
  89.     void *                            buffer;
  90.     long                             dataSize;
  91. };
  92. typedef struct MailBuffer MailBuffer;
  93.  
  94. /*
  95.  A MailReply is used to describe a commonly used reply buffer format.
  96. It contains a count of tuples followed by an array of tuples.
  97. The format of the tuple itself depends on each particular call.
  98. */
  99. struct MailReply {
  100.     unsigned short                     tupleCount;
  101.                                                                 /* tuple[tupleCount] */
  102. };
  103. typedef struct MailReply MailReply;
  104.  
  105. /*
  106.  Shared Memory Communication Area used when Mail Manager sends 
  107. High Level Events to a PMSAM. 
  108. */
  109. struct SMCA {
  110.     unsigned short                     smcaLength;                    /* includes size of smcaLength field */
  111.     OSErr                             result;
  112.     long                             userBytes;
  113.     union {
  114.         CreationID                         slotCID;                /* for create/modify/delete slot calls */
  115.         long                             msgHint;                /* for kMailEPPCMsgOpened */
  116.     } u;
  117. };
  118. typedef struct SMCA SMCA;
  119.  
  120. /**************************************************************************************/
  121. /* Value of creator and types fields for messages and blocks defined by MailManager */
  122.  
  123. enum {
  124.     kMailAppleMailCreator        = 'apml',                        /* message and letter block creator */
  125.     kMailLtrMsgType                = 'lttr',                        /* message type of letters, reports */
  126.     kMailLtrHdrType                = 'lthd',                        /* contains letter header */
  127.     kMailContentType            = 'body',                        /* contains content of letter */
  128.     kMailEnclosureListType        = 'elst',                        /* contains list of enclosures */
  129.     kMailEnclosureDesktopType    = 'edsk',                        /* contains desktop mgr info for enclosures */
  130.     kMailEnclosureFileType        = 'asgl',                        /* contains a file enclosure, format is defined by AppleSingle */
  131.     kMailImageBodyType            = 'imag',                        /* contains image of letter */
  132.     kMailMSAMType                = 'gwyi',                        /* contains msam specific information */
  133.     kMailTunnelLtrType            = 'tunl',                        /* used to read a tunnelled message */
  134.     kMailHopInfoType            = 'hopi',                        /* used to read hopInfo for a tunnelled message */
  135.     kMailReportType                = 'rpti',                        /* contains report info */
  136.     kMailFamily                    = 'mail',                        /* Defines family of "mail" msgs: content, header, etc */
  137.     kMailFamilyFile                = 'file'                        /* Defines family of "direct display" msgs */
  138. };
  139.  
  140. /*
  141. kMailImageBodyType:
  142.     format is struct TPfPgDir - in Printing.h
  143.     *    struct TPfPgDir {
  144.     *        short    pageCount;        - number of pages in the image.
  145.     *        long    iPgPos[129];    - iPgPos[n] is the offset from the start of the block
  146.     *                                - to image of page n.
  147.     *                                - iPgPos[n+1] - iPgPos[n] is the length of page n.
  148.  
  149. kMailReportType:
  150. Reports have the isReport bit set in MailIndications and contain a block of type kMailReport.
  151. This block has a header, IPMReportBlockHeader,
  152. followed by an array of elements, each of type IPMRecipientReport
  153.  
  154. Various families used by mail or related msgs
  155. */
  156. /**************************************************************************************/
  157. typedef unsigned short MailAttributeID;
  158. /* Values of MailAttributeID */
  159. /* Message store attributes - stored in the catalog */
  160. /* Will always be present in a letter and have fixed sizes */
  161.  
  162. enum {
  163.     kMailLetterFlagsBit            = 1,                            /* MailLetterFlags */
  164.                                                                 /* Letter attributes - stored in the letter will always be present in a letter and have fixed sizes */
  165.     kMailIndicationsBit            = 3,                            /* MailIndications */
  166.     kMailMsgTypeBit                = 4,                            /* OCECreatorType */
  167.     kMailLetterIDBit            = 5,                            /* MailLetterID */
  168.     kMailSendTimeStampBit        = 6,                            /* MailTime */
  169.     kMailNestingLevelBit        = 7,                            /* MailNestingLevel */
  170.     kMailMsgFamilyBit            = 8,                            /* OSType */
  171.                                                                 /* Letter attributes - stored in the letter may be present in a letter and have fixed sizes */
  172.     kMailReplyIDBit                = 9,                            /* MailLetterID */
  173.     kMailConversationIDBit        = 10,                            /* MailLetterID */
  174.                                                                 /* Letter attributes - stored in the letter may be present in a letter and have variable length sizes */
  175.     kMailSubjectBit                = 11,                            /* RString */
  176.     kMailFromBit                = 12,                            /* MailRecipient */
  177.     kMailToBit                    = 13,                            /* MailRecipient */
  178.     kMailCcBit                    = 14,                            /* MailRecipient */
  179.     kMailBccBit                    = 15                            /* MailRecipient */
  180. };
  181.  
  182. typedef unsigned long MailAttributeMask;
  183. /* Values of MailAttributeMask */
  184.  
  185. enum {
  186.     kMailLetterFlagsMask        = 1L << (kMailLetterFlagsBit - 1),
  187.     kMailIndicationsMask        = 1L << (kMailIndicationsBit - 1),
  188.     kMailMsgTypeMask            = 1L << (kMailMsgTypeBit - 1),
  189.     kMailLetterIDMask            = 1L << (kMailLetterIDBit - 1),
  190.     kMailSendTimeStampMask        = 1L << (kMailSendTimeStampBit - 1),
  191.     kMailNestingLevelMask        = 1L << (kMailNestingLevelBit - 1),
  192.     kMailMsgFamilyMask            = 1L << (kMailMsgFamilyBit - 1),
  193.     kMailReplyIDMask            = 1L << (kMailReplyIDBit - 1),
  194.     kMailConversationIDMask        = 1L << (kMailConversationIDBit - 1),
  195.     kMailSubjectMask            = 1L << (kMailSubjectBit - 1),
  196.     kMailFromMask                = 1L << (kMailFromBit - 1),
  197.     kMailToMask                    = 1L << (kMailToBit - 1),
  198.     kMailCcMask                    = 1L << (kMailCcBit - 1),
  199.     kMailBccMask                = 1L << (kMailBccBit - 1)
  200. };
  201.  
  202. typedef unsigned long MailAttributeBitmap;
  203. /**************************************************************************************/
  204. typedef unsigned short MailLetterSystemFlags;
  205. /* Values of MailLetterSystemFlags */
  206. /* letter is available locally (either by nature or via cache) */
  207.  
  208. enum {
  209.     kMailIsLocalBit                = 2
  210. };
  211.  
  212.  
  213. enum {
  214.     kMailIsLocalMask            = 1L << kMailIsLocalBit
  215. };
  216.  
  217. typedef unsigned short MailLetterUserFlags;
  218.  
  219. enum {
  220.     kMailReadBit                = 0,                            /* this letter has been opened */
  221.     kMailDontArchiveBit            = 1,                            /* this letter is not to be archived either because it has already been archived or it should not be archived. */
  222.     kMailInTrashBit                = 2                                /* this letter is in trash */
  223. };
  224.  
  225. /* Values of MailLetterUserFlags */
  226.  
  227. enum {
  228.     kMailReadMask                = 1L << kMailReadBit,
  229.     kMailDontArchiveMask        = 1L << kMailDontArchiveBit,
  230.     kMailInTrashMask            = 1L << kMailInTrashBit
  231. };
  232.  
  233. struct MailLetterFlags {
  234.     MailLetterSystemFlags             sysFlags;
  235.     MailLetterUserFlags             userFlags;
  236. };
  237. typedef struct MailLetterFlags MailLetterFlags;
  238.  
  239. struct MailMaskedLetterFlags {
  240.     MailLetterFlags                 flagMask;                    /* flags that are to be set */
  241.     MailLetterFlags                 flagValues;                    /* and their values */
  242. };
  243. typedef struct MailMaskedLetterFlags MailMaskedLetterFlags;
  244.  
  245.  
  246. enum {
  247.     kMailOriginalInReportBit    = 1,
  248.     kMailNonReceiptReportsBit    = 3,
  249.     kMailReceiptReportsBit        = 4,
  250.     kMailForwardedBit            = 5,
  251.     kMailPriorityBit            = 6,
  252.     kMailIsReportWithOriginalBit = 8,
  253.     kMailIsReportBit            = 9,
  254.     kMailHasContentBit            = 10,
  255.     kMailHasSignatureBit        = 11,
  256.     kMailAuthenticatedBit        = 12,
  257.     kMailSentBit                = 13,
  258.     kMailNativeContentBit        = 14,
  259.     kMailImageContentBit        = 15,
  260.     kMailStandardContentBit        = 16
  261. };
  262.  
  263. /* Values of MailIndications */
  264.  
  265. enum {
  266.     kMailStandardContentMask    = 1L << (kMailStandardContentBit - 1),
  267.     kMailImageContentMask        = 1L << (kMailImageContentBit - 1),
  268.     kMailNativeContentMask        = 1L << (kMailNativeContentBit - 1),
  269.     kMailSentMask                = 1L << (kMailSentBit - 1),
  270.     kMailAuthenticatedMask        = 1L << (kMailAuthenticatedBit - 1),
  271.     kMailHasSignatureMask        = 1L << (kMailHasSignatureBit - 1),
  272.     kMailHasContentMask            = 1L << (kMailHasContentBit - 1),
  273.     kMailIsReportMask            = 1L << (kMailIsReportBit - 1),
  274.     kMailIsReportWithOriginalMask = 1L << (kMailIsReportWithOriginalBit - 1),
  275.     kMailPriorityMask            = 3L << (kMailPriorityBit - 1),
  276.     kMailForwardedMask            = 1L << (kMailForwardedBit - 1),
  277.     kMailReceiptReportsMask        = 1L << (kMailReceiptReportsBit - 1),
  278.     kMailNonReceiptReportsMask    = 1L << (kMailNonReceiptReportsBit - 1),
  279.     kMailOriginalInReportMask    = 3L << (kMailOriginalInReportBit - 1)
  280. };
  281.  
  282. typedef unsigned long MailIndications;
  283. /* values of the field originalInReport in MailIndications */
  284.  
  285. enum {
  286.     kMailNoOriginal                = 0,                            /* do not enclose original in reports */
  287.     kMailEncloseOnNonReceipt    = 3                                /* enclose original in non-delivery reports */
  288. };
  289.  
  290. typedef IPMMsgID MailLetterID;
  291. struct MailTime {
  292.     UTCTime                         time;                        /* current UTC(GMT) time */
  293.     UTCOffset                         offset;                        /* offset from GMT */
  294. };
  295. typedef struct MailTime MailTime;
  296.  
  297. /* innermost letter has nestingLevel 0 */
  298. typedef unsigned short MailNestingLevel;
  299. typedef OCERecipient MailRecipient;
  300. /**************************************************************************************/
  301.  
  302. enum {
  303.     kMailTextSegmentBit            = 0,
  304.     kMailPictSegmentBit            = 1,
  305.     kMailSoundSegmentBit        = 2,
  306.     kMailStyledTextSegmentBit    = 3,
  307.     kMailMovieSegmentBit        = 4
  308. };
  309.  
  310. typedef unsigned short MailSegmentMask;
  311. /* Values of MailSegmentMask */
  312.  
  313. enum {
  314.     kMailTextSegmentMask        = 1L << kMailTextSegmentBit,
  315.     kMailPictSegmentMask        = 1L << kMailPictSegmentBit,
  316.     kMailSoundSegmentMask        = 1L << kMailSoundSegmentBit,
  317.     kMailStyledTextSegmentMask    = 1L << kMailStyledTextSegmentBit,
  318.     kMailMovieSegmentMask        = 1L << kMailMovieSegmentBit
  319. };
  320.  
  321. typedef unsigned short MailSegmentType;
  322. /* Values of MailSegmentType */
  323.  
  324. enum {
  325.     kMailInvalidSegmentType        = 0,
  326.     kMailTextSegmentType        = 1,
  327.     kMailPictSegmentType        = 2,
  328.     kMailSoundSegmentType        = 3,
  329.     kMailStyledTextSegmentType    = 4,
  330.     kMailMovieSegmentType        = 5
  331. };
  332.  
  333. /**************************************************************************************/
  334.  
  335. enum {
  336.     kMailErrorLogEntryVersion    = 0x0101,
  337.     kMailMSAMErrorStringListID    = 128,                            /* These 'STR#' resources should be */
  338.     kMailMSAMActionStringListID    = 129                            /* in the PMSAM resource fork */
  339. };
  340.  
  341. typedef unsigned short MailLogErrorType;
  342. /* Values of MailLogErrorType */
  343.  
  344. enum {
  345.     kMailELECorrectable            = 0,
  346.     kMailELEError                = 1,
  347.     kMailELEWarning                = 2,
  348.     kMailELEInformational        = 3
  349. };
  350.  
  351. typedef short MailLogErrorCode;
  352. /* Values of MailLogErrorCode */
  353.  
  354. enum {
  355.     kMailMSAMErrorCode            = 0,                            /* positive codes are indices into PMSAM defined strings */
  356.     kMailMiscError                = -1,                            /* negative codes are OCE defined */
  357.     kMailNoModem                = -2                            /* modem required, but missing */
  358. };
  359.  
  360. struct MailErrorLogEntryInfo {
  361.     short                             version;
  362.     UTCTime                         timeOccurred;                /* do not fill in */
  363.     Str31                             reportingPMSAM;                /* do not fill in */
  364.     Str31                             reportingMSAMSlot;            /* do not fill in */
  365.     MailLogErrorType                 errorType;
  366.     MailLogErrorCode                 errorCode;
  367.  
  368.     short                             errorResource;                /* resources are valid if */
  369.     short                             actionResource;                /* errorCode = kMailMSAMErrorCode index starts from 1 */
  370.     unsigned long                     filler;
  371.     unsigned short                     filler2;
  372. };
  373. typedef struct MailErrorLogEntryInfo MailErrorLogEntryInfo;
  374.  
  375. /**************************************************************************************/
  376. typedef short MailBlockMode;
  377. /* Values of MailBlockMode */
  378.  
  379. enum {
  380.     kMailFromStart                = 1,                            /* write data from offset calculated from */
  381.     kMailFromLEOB                = 2,                            /* start of block, end of block, */
  382.     kMailFromMark                = 3                                /* or from the current mark */
  383. };
  384.  
  385. struct MailEnclosureInfo {
  386.     StringPtr                         enclosureName;
  387.     CInfoPBPtr                         catInfo;
  388.     StringPtr                         comment;
  389.     void *                            icon;
  390. };
  391. typedef struct MailEnclosureInfo MailEnclosureInfo;
  392.  
  393. /**************************************************************************************/
  394.  
  395. enum {
  396.     kOCESetupLocationNone        = 0,                            /* disconnect state */
  397.     kOCESetupLocationMax        = 8                                /* maximum location value */
  398. };
  399.  
  400. typedef char OCESetupLocation;
  401. /*
  402.  location state is a bitmask, 0x1=>1st location active, 
  403.  * 0x2 => 2nd, 0x4 => 3rd, etc.
  404. */
  405. #define MailLocationMask(locationNumber) (1<<((locationNumber)-1))
  406. typedef UInt8 MailLocationFlags;
  407. struct MailLocationInfo {
  408.     OCESetupLocation                 location;
  409.     MailLocationFlags                 active;
  410. };
  411. typedef struct MailLocationInfo MailLocationInfo;
  412.  
  413. /**************************************************************************************/
  414. /* Definitions for Personal MSAMs */
  415. /**************************************************************************************/
  416.  
  417. enum {
  418.     kMailEPPCMsgVersion            = 3
  419. };
  420.  
  421. struct MailEPPCMsg {
  422.     short                             version;
  423.     union {
  424.         SMCA *                            theSMCA;                /* for 'crsl', 'mdsl', 'dlsl', 'sndi', 'msgo', 'admn' */
  425.         long                             sequenceNumber;            /* for 'inqu', 'dlom' */
  426.         MailLocationInfo                 locationInfo;            /* for 'locc' */
  427.     }                                 u;
  428. };
  429. typedef struct MailEPPCMsg MailEPPCMsg;
  430.  
  431. /* Values of OCE defined High Level Event message classes */
  432.  
  433. enum {
  434.     kMailEPPCCreateSlot            = 'crsl',
  435.     kMailEPPCModifySlot            = 'mdsl',
  436.     kMailEPPCDeleteSlot            = 'dlsl',
  437.     kMailEPPCShutDown            = 'quit',
  438.     kMailEPPCMailboxOpened        = 'mbop',
  439.     kMailEPPCMailboxClosed        = 'mbcl',
  440.     kMailEPPCMsgPending            = 'msgp',
  441.     kMailEPPCSendImmediate        = 'sndi',
  442.     kMailEPPCContinue            = 'cont',
  443.     kMailEPPCSchedule            = 'sked',
  444.     kMailEPPCAdmin                = 'admn',
  445.     kMailEPPCInQUpdate            = 'inqu',
  446.     kMailEPPCMsgOpened            = 'msgo',
  447.     kMailEPPCDeleteOutQMsg        = 'dlom',
  448.     kMailEPPCWakeup                = 'wkup',
  449.     kMailEPPCLocationChanged    = 'locc'
  450. };
  451.  
  452. union MailTimer {
  453.     long                             frequency;                    /* how often to connect */
  454.     long                             connectTime;                /* time since midnight */
  455. };
  456. typedef union MailTimer MailTimer;
  457.  
  458.  
  459. enum {
  460.     kMailTimerOff                = 0,                            /* control is off */
  461.     kMailTimerTime                = 1,                            /* specifies connect time (relative to midnight) */
  462.     kMailTimerFrequency            = 2                                /* specifies connect frequency */
  463. };
  464.  
  465. typedef Byte MailTimerKind;
  466. struct MailTimers {
  467.     MailTimerKind                     sendTimeKind;                /* either kMailTimerTime or kMailTimerFrequency */
  468.     MailTimerKind                     receiveTimeKind;            /* either kMailTimerTime or kMailTimerFrequency */
  469.     MailTimer                         send;
  470.     MailTimer                         receive;
  471. };
  472. typedef struct MailTimers MailTimers;
  473.  
  474. struct MailStandardSlotInfoAttribute {
  475.     short                             version;
  476.     MailLocationFlags                 active;                        /* active if MailLocationMask(i) is set */
  477.     Byte                             padByte;
  478.     MailTimers                         sendReceiveTimer;
  479. };
  480. typedef struct MailStandardSlotInfoAttribute MailStandardSlotInfoAttribute;
  481.  
  482. /*
  483.         This ProcPtr uses register based parameters on the 68k and cannot
  484.         be written in or called from a high-level language without the help of
  485.         mixed mode or assembly glue.
  486.  
  487.             typedef pascal void (*MSAMIOCompletionProcPtr)(MSAMParam *paramBlock);
  488.  
  489. */
  490.  
  491. #if GENERATINGCFM
  492. typedef UniversalProcPtr MSAMIOCompletionUPP;
  493. #else
  494. typedef Register68kProcPtr MSAMIOCompletionUPP;
  495. #endif
  496. struct PMSAMGetMSAMRecordPB {
  497.     void *                            qLink;
  498.     long                             reservedH1;
  499.     long                             reservedH2;
  500.     MSAMIOCompletionUPP             ioCompletion;
  501.     OSErr                             ioResult;
  502.     long                             saveA5;
  503.     short                             reqCode;
  504.     CreationID                         msamCID;
  505. };
  506. typedef struct PMSAMGetMSAMRecordPB PMSAMGetMSAMRecordPB;
  507.  
  508. struct PMSAMOpenQueuesPB {
  509.     void *                            qLink;
  510.     long                             reservedH1;
  511.     long                             reservedH2;
  512.     MSAMIOCompletionUPP             ioCompletion;
  513.     OSErr                             ioResult;
  514.     long                             saveA5;
  515.     short                             reqCode;
  516.     MSAMQueueRef                     inQueueRef;
  517.     MSAMQueueRef                     outQueueRef;
  518.     MSAMSlotID                         msamSlotID;
  519.     long                             filler[2];
  520. };
  521. typedef struct PMSAMOpenQueuesPB PMSAMOpenQueuesPB;
  522.  
  523. typedef unsigned short PMSAMStatus;
  524. /* Values of PMSAMStatus */
  525.  
  526. enum {
  527.     kPMSAMStatusPending            = 1,                            /* for inQueue and outQueue */
  528.     kPMSAMStatusError            = 2,                            /* for inQueue and outQueue */
  529.     kPMSAMStatusSending            = 3,                            /* for outQueue only */
  530.     kPMSAMStatusCaching            = 4,                            /* for inQueue only */
  531.     kPMSAMStatusSent            = 5                                /* for outQueue only */
  532. };
  533.  
  534. struct PMSAMSetStatusPB {
  535.     void *                            qLink;
  536.     long                             reservedH1;
  537.     long                             reservedH2;
  538.     MSAMIOCompletionUPP             ioCompletion;
  539.     OSErr                             ioResult;
  540.     long                             saveA5;
  541.     short                             reqCode;
  542.     MSAMQueueRef                     queueRef;
  543.     long                             seqNum;
  544.     long                             msgHint;                    /* for posting cache error,set this to 0 when report outq status */
  545.     PMSAMStatus                     status;
  546. };
  547. typedef struct PMSAMSetStatusPB PMSAMSetStatusPB;
  548.  
  549. struct PMSAMLogErrorPB {
  550.     void *                            qLink;
  551.     long                             reservedH1;
  552.     long                             reservedH2;
  553.     MSAMIOCompletionUPP             ioCompletion;
  554.     OSErr                             ioResult;
  555.     long                             saveA5;
  556.     short                             reqCode;
  557.     MSAMSlotID                         msamSlotID;                    /* 0 for PMSAM errors */
  558.     MailErrorLogEntryInfo *            logEntry;
  559.     long                             filler[2];
  560. };
  561. typedef struct PMSAMLogErrorPB PMSAMLogErrorPB;
  562.  
  563. /****************************************************************************************/
  564.  
  565. enum {
  566.     kMailMsgSummaryVersion        = 1
  567. };
  568.  
  569. struct MailMasterData {
  570.     MailAttributeBitmap             attrMask;                    /* indicates attributes present in MsgSummary */
  571.     MailLetterID                     messageID;
  572.     MailLetterID                     replyID;
  573.     MailLetterID                     conversationID;
  574. };
  575. typedef struct MailMasterData MailMasterData;
  576.  
  577. /* Values for addressedToMe in struct MailCoreData */
  578.  
  579. enum {
  580.     kAddressedAs_TO                = 0x01,
  581.     kAddressedAs_CC                = 0x02,
  582.     kAddressedAs_BCC            = 0x04
  583. };
  584.  
  585. struct MailCoreData {
  586.     MailLetterFlags                 letterFlags;
  587.     unsigned long                     messageSize;
  588.     MailIndications                 letterIndications;
  589.     OCECreatorType                     messageType;
  590.     MailTime                         sendTime;
  591.     OSType                             messageFamily;
  592.     unsigned char                     reserved;
  593.     unsigned char                     addressedToMe;
  594.     char                             agentInfo[6];                /* 6 bytes of special info [set to zero] */
  595.                                                                 /* these are variable length and even padded */
  596.     RString32                         sender;                        /* recipient's entityName (trunc)*/
  597.     RString32                         subject;                    /* subject maybe truncated */
  598. };
  599. typedef struct MailCoreData MailCoreData;
  600.  
  601. struct MSAMMsgSummary {
  602.     short                             version;                    /* following flags are defaulted by Toolbox */
  603.     Boolean                         msgDeleted;                    /* true if msg is to be deleted by PMSAM */
  604.     Boolean                         msgUpdated;                    /* true if msgSummary was updated by MailManager */
  605.     Boolean                         msgCached;                    /* true if msg is in the slot's InQueue */
  606.     Byte                             padByte;
  607.  
  608.     MailMasterData                     masterData;
  609.     MailCoreData                     coreData;
  610. };
  611. typedef struct MSAMMsgSummary MSAMMsgSummary;
  612.  
  613. /* PMSAM can put up to 128 bytes of private msg summary data */
  614.  
  615. enum {
  616.     kMailMaxPMSAMMsgSummaryData    = 128
  617. };
  618.  
  619. struct PMSAMCreateMsgSummaryPB {
  620.     void *                            qLink;
  621.     long                             reservedH1;
  622.     long                             reservedH2;
  623.     MSAMIOCompletionUPP             ioCompletion;
  624.     OSErr                             ioResult;
  625.     long                             saveA5;
  626.     short                             reqCode;
  627.     MSAMQueueRef                     inQueueRef;
  628.     long                             seqNum;                        /* <- seq of the new message */
  629.     MSAMMsgSummary *                msgSummary;                    /* attributes and mask filled in */
  630.     MailBuffer *                    buffer;                        /* PMSAM specific data to be appended */
  631. };
  632. typedef struct PMSAMCreateMsgSummaryPB PMSAMCreateMsgSummaryPB;
  633.  
  634. struct PMSAMPutMsgSummaryPB {
  635.     void *                            qLink;
  636.     long                             reservedH1;
  637.     long                             reservedH2;
  638.     MSAMIOCompletionUPP             ioCompletion;
  639.     OSErr                             ioResult;
  640.     long                             saveA5;
  641.     short                             reqCode;
  642.     MSAMQueueRef                     inQueueRef;
  643.     long                             seqNum;
  644.     MailMaskedLetterFlags *            letterFlags;                /* if not nil, then set msgStoreFlags */
  645.     MailBuffer *                    buffer;                        /* PMSAM specific data to be overwritten */
  646. };
  647. typedef struct PMSAMPutMsgSummaryPB PMSAMPutMsgSummaryPB;
  648.  
  649. struct PMSAMGetMsgSummaryPB {
  650.     void *                            qLink;
  651.     long                             reservedH1;
  652.     long                             reservedH2;
  653.     MSAMIOCompletionUPP             ioCompletion;
  654.     OSErr                             ioResult;
  655.     long                             saveA5;
  656.     short                             reqCode;
  657.     MSAMQueueRef                     inQueueRef;
  658.     long                             seqNum;
  659.     MSAMMsgSummary *                msgSummary;                    /* if not nil, then read in the msgSummary */
  660.     MailBuffer *                    buffer;                        /* PMSAM specific data to be read */
  661.     unsigned short                     msgSummaryOffset;            /* offset of PMSAM specific data from start of MsgSummary */
  662. };
  663. typedef struct PMSAMGetMsgSummaryPB PMSAMGetMsgSummaryPB;
  664.  
  665. /****************************************************************************************/
  666. /* Definitions for Server MSAMs */
  667. /**************************************************************************************/
  668. typedef unsigned short SMSAMAdminCode;
  669. /* Values of SMSAMAdminCode */
  670.  
  671. enum {
  672.     kSMSAMNotifyFwdrSetupChange    = 1,
  673.     kSMSAMNotifyFwdrNameChange    = 2,
  674.     kSMSAMNotifyFwdrPwdChange    = 3,
  675.     kSMSAMGetDynamicFwdrParams    = 4
  676. };
  677.  
  678. typedef unsigned long SMSAMSlotChanges;
  679.  
  680. enum {
  681.     kSMSAMFwdrHomeInternetChangedBit = 0,
  682.     kSMSAMFwdrConnectedToChangedBit = 1,
  683.     kSMSAMFwdrForeignRLIsChangedBit = 2,
  684.     kSMSAMFwdrMnMServerChangedBit = 3
  685. };
  686.  
  687. /* Values of SMSAMSlotChanges */
  688.  
  689. enum {
  690.     kSMSAMFwdrEverythingChangedMask = -1,
  691.     kSMSAMFwdrHomeInternetChangedMask = 1L << kSMSAMFwdrHomeInternetChangedBit,
  692.     kSMSAMFwdrConnectedToChangedMask = 1L << kSMSAMFwdrConnectedToChangedBit,
  693.     kSMSAMFwdrForeignRLIsChangedMask = 1L << kSMSAMFwdrForeignRLIsChangedBit,
  694.     kSMSAMFwdrMnMServerChangedMask = 1L << kSMSAMFwdrMnMServerChangedBit
  695. };
  696.  
  697. /* kSMSAMNotifyFwdrSetupChange */
  698. struct SMSAMSetupChange {
  699.     SMSAMSlotChanges                 whatChanged;                /*  --> bitmap of what parameters changed */
  700.     AddrBlock                         serverHint;                    /*  --> try this ADAP server first */
  701. };
  702. typedef struct SMSAMSetupChange SMSAMSetupChange;
  703.  
  704. /* kSMSAMNotifyFwdrNameChange */
  705. struct SMSAMNameChange {
  706.     RString                         newName;                    /*  --> msams new name */
  707.     AddrBlock                         serverHint;                    /*  --> try this ADAP server first */
  708. };
  709. typedef struct SMSAMNameChange SMSAMNameChange;
  710.  
  711. /* kSMSAMNotifyFwdrPasswordChange */
  712. struct SMSAMPasswordChange {
  713.     RString                         newPassword;                /*  --> msams new password */
  714.     AddrBlock                         serverHint;                    /*  --> try this ADAP server first */
  715. };
  716. typedef struct SMSAMPasswordChange SMSAMPasswordChange;
  717.  
  718. /* kSMSAMGetDynamicFwdrParams */
  719. struct SMSAMDynamicParams {
  720.     unsigned long                     curDiskUsed;                /* <--  amount of disk space used by msam */
  721.     unsigned long                     curMemoryUsed;                /* <--  amount of memory used by msam */
  722. };
  723. typedef struct SMSAMDynamicParams SMSAMDynamicParams;
  724.  
  725. struct SMSAMAdminEPPCRequest {
  726.     SMSAMAdminCode                     adminCode;
  727.     union {
  728.         SMSAMSetupChange                 setupChange;
  729.         SMSAMNameChange                 nameChange;
  730.         SMSAMPasswordChange             passwordChange;
  731.         SMSAMDynamicParams                 dynamicParams;
  732.     }                                 u;
  733. };
  734. typedef struct SMSAMAdminEPPCRequest SMSAMAdminEPPCRequest;
  735.  
  736. struct SMSAMSetupPB {
  737.     void *                            qLink;
  738.     long                             reservedH1;
  739.     long                             reservedH2;
  740.     MSAMIOCompletionUPP             ioCompletion;
  741.     OSErr                             ioResult;
  742.     long                             saveA5;
  743.     short                             reqCode;
  744.     RecordIDPtr                     serverMSAM;
  745.     RStringPtr                         password;
  746.     OSType                             gatewayType;
  747.     RStringPtr                         gatewayTypeDescription;
  748.     AddrBlock                         catalogServerHint;
  749. };
  750. typedef struct SMSAMSetupPB SMSAMSetupPB;
  751.  
  752. struct SMSAMStartupPB {
  753.     void *                            qLink;
  754.     long                             reservedH1;
  755.     long                             reservedH2;
  756.     MSAMIOCompletionUPP             ioCompletion;
  757.     OSErr                             ioResult;
  758.     long                             saveA5;
  759.     short                             reqCode;
  760.     AuthIdentity                     msamIdentity;
  761.     MSAMQueueRef                     queueRef;
  762. };
  763. typedef struct SMSAMStartupPB SMSAMStartupPB;
  764.  
  765. struct SMSAMShutdownPB {
  766.     void *                            qLink;
  767.     long                             reservedH1;
  768.     long                             reservedH2;
  769.     MSAMIOCompletionUPP             ioCompletion;
  770.     OSErr                             ioResult;
  771.     long                             saveA5;
  772.     short                             reqCode;
  773.     MSAMQueueRef                     queueRef;
  774. };
  775. typedef struct SMSAMShutdownPB SMSAMShutdownPB;
  776.  
  777. /****************************************************************************************/
  778. /* Definitions for reading and writing MSAM Letters */
  779. /****************************************************************************************/
  780. struct MSAMEnumeratePB {
  781.     void *                            qLink;
  782.     long                             reservedH1;
  783.     long                             reservedH2;
  784.     MSAMIOCompletionUPP             ioCompletion;
  785.     OSErr                             ioResult;
  786.     long                             saveA5;
  787.     short                             reqCode;
  788.     MSAMQueueRef                     queueRef;
  789.     long                             startSeqNum;
  790.     long                             nextSeqNum;
  791.                                                                 /* buffer contains a Mail Reply. Each tuple is a MSAMEnumerateInQReply when enumerating the inQueue MSAMEnumerateOutQReply when enumerating the outQueue */
  792.     MailBuffer                         buffer;
  793. };
  794. typedef struct MSAMEnumeratePB MSAMEnumeratePB;
  795.  
  796. struct MSAMEnumerateInQReply {
  797.     long                             seqNum;
  798.     Boolean                         msgDeleted;                    /* true if msg is to be deleted by PMSAM */
  799.     Boolean                         msgUpdated;                    /* true if MsgSummary has been updated by TB */
  800.     Boolean                         msgCached;                    /* true if msg is in the incoming queue */
  801.     Byte                             padByte;
  802. };
  803. typedef struct MSAMEnumerateInQReply MSAMEnumerateInQReply;
  804.  
  805. struct MSAMEnumerateOutQReply {
  806.     long                             seqNum;
  807.     Boolean                         done;                        /* true if all responsible recipients have been processed */
  808.     IPMPriority                     priority;
  809.     OSType                             msgFamily;
  810.     long                             approxSize;
  811.     Boolean                         tunnelForm;                    /* true if this letter has to be tunnelled */
  812.     Byte                             padByte;
  813.     NetworkSpec                     nextHop;                    /* valid if tunnelForm is true */
  814.     OCECreatorType                     msgType;
  815. };
  816. typedef struct MSAMEnumerateOutQReply MSAMEnumerateOutQReply;
  817.  
  818. struct MSAMDeletePB {
  819.     void *                            qLink;
  820.     long                             reservedH1;
  821.     long                             reservedH2;
  822.     MSAMIOCompletionUPP             ioCompletion;
  823.     OSErr                             ioResult;
  824.     long                             saveA5;
  825.     short                             reqCode;
  826.     MSAMQueueRef                     queueRef;
  827.     long                             seqNum;
  828.     Boolean                         msgOnly;                    /* only valid for PMSAM & inQueue */
  829.                                                                 /* set true to delete message but not msgSummary */
  830.     Byte                             padByte;
  831.                                                                 /* only valid for SMSAM & tunnelled messages */
  832.     OSErr                             result;
  833. };
  834. typedef struct MSAMDeletePB MSAMDeletePB;
  835.  
  836. struct MSAMOpenPB {
  837.     void *                            qLink;
  838.     long                             reservedH1;
  839.     long                             reservedH2;
  840.     MSAMIOCompletionUPP             ioCompletion;
  841.     OSErr                             ioResult;
  842.     long                             saveA5;
  843.     short                             reqCode;
  844.     MSAMQueueRef                     queueRef;
  845.     long                             seqNum;
  846.     MailMsgRef                         mailMsgRef;
  847. };
  848. typedef struct MSAMOpenPB MSAMOpenPB;
  849.  
  850. struct MSAMOpenNestedPB {
  851.     void *                            qLink;
  852.     long                             reservedH1;
  853.     long                             reservedH2;
  854.     MSAMIOCompletionUPP             ioCompletion;
  855.     OSErr                             ioResult;
  856.     long                             saveA5;
  857.     short                             reqCode;
  858.     MailMsgRef                         mailMsgRef;
  859.     MailMsgRef                         nestedRef;
  860. };
  861. typedef struct MSAMOpenNestedPB MSAMOpenNestedPB;
  862.  
  863. struct MSAMClosePB {
  864.     void *                            qLink;
  865.     long                             reservedH1;
  866.     long                             reservedH2;
  867.     MSAMIOCompletionUPP             ioCompletion;
  868.     OSErr                             ioResult;
  869.     long                             saveA5;
  870.     short                             reqCode;
  871.     MailMsgRef                         mailMsgRef;
  872. };
  873. typedef struct MSAMClosePB MSAMClosePB;
  874.  
  875. struct MSAMGetMsgHeaderPB {
  876.     void *                            qLink;
  877.     long                             reservedH1;
  878.     long                             reservedH2;
  879.     MSAMIOCompletionUPP             ioCompletion;
  880.     OSErr                             ioResult;
  881.     long                             saveA5;
  882.     short                             reqCode;
  883.     MailMsgRef                         mailMsgRef;
  884.     IPMHeaderSelector                 selector;
  885.     Boolean                         filler1;
  886.     unsigned long                     offset;
  887.     MailBuffer                         buffer;
  888.     unsigned long                     remaining;
  889. };
  890. typedef struct MSAMGetMsgHeaderPB MSAMGetMsgHeaderPB;
  891.  
  892. /*
  893.     MSAMGetAttributesPB.buffer returned will contain the attribute values of 
  894.     the attributes indicated in responseMask, 
  895.     from the attribute indicated by the least significant bit set
  896.     to the attribute indicated by the most significant bit set.
  897.     Note that recipients - from, to, cc, bcc cannot be read using
  898.     this call. Use GetRecipients to read these. 
  899. */
  900. struct MSAMGetAttributesPB {
  901.     void *                            qLink;
  902.     long                             reservedH1;
  903.     long                             reservedH2;
  904.     MSAMIOCompletionUPP             ioCompletion;
  905.     OSErr                             ioResult;
  906.     long                             saveA5;
  907.     short                             reqCode;
  908.     MailMsgRef                         mailMsgRef;
  909.     MailAttributeBitmap             requestMask;                /* kMailIndicationsBit thru kMailSubjectBit */
  910.     MailBuffer                         buffer;
  911.     MailAttributeBitmap             responseMask;
  912.     Boolean                         more;
  913.     Boolean                         filler1;
  914. };
  915. typedef struct MSAMGetAttributesPB MSAMGetAttributesPB;
  916.  
  917. /* attrID value to get resolved recipient list */
  918.  
  919. enum {
  920.     kMailResolvedList            = 0
  921. };
  922.  
  923. struct MailOriginalRecipient {
  924.     short                             index;
  925. };
  926. typedef struct MailOriginalRecipient MailOriginalRecipient;
  927.  
  928. /* Followed by OCEPackedRecipient */
  929. struct MailResolvedRecipient {
  930.     short                             index;
  931.     short                             recipientFlags;
  932.     Boolean                         responsible;
  933.     Byte                             padByte;
  934. };
  935. typedef struct MailResolvedRecipient MailResolvedRecipient;
  936.  
  937. /* Followed by OCEPackedRecipient */
  938. /*
  939.      MSAMGetRecipientsPB.buffer contains a Mail Reply. Each tuple is a
  940.     MailOriginalRecipient if getting original recipients 
  941.                             ie the attrID is kMail[From, To, Cc, Bcc]Bit
  942.     MailResolvedRecipient if getting resolved reicpients
  943.                             ie the attrID is kMailResolvedList
  944.     Both tuples are word alligned.  
  945. */
  946. struct MSAMGetRecipientsPB {
  947.     void *                            qLink;
  948.     long                             reservedH1;
  949.     long                             reservedH2;
  950.     MSAMIOCompletionUPP             ioCompletion;
  951.     OSErr                             ioResult;
  952.     long                             saveA5;
  953.     short                             reqCode;
  954.     MailMsgRef                         mailMsgRef;
  955.     MailAttributeID                 attrID;                        /* kMailFromBit thru kMailBccBit */
  956.     unsigned short                     startIndex;                    /* starts at 1 */
  957.     MailBuffer                         buffer;
  958.     unsigned short                     nextIndex;
  959.     Boolean                         more;
  960.     Boolean                         filler1;
  961. };
  962. typedef struct MSAMGetRecipientsPB MSAMGetRecipientsPB;
  963.  
  964. struct MSAMGetContentPB {
  965.     void *                            qLink;
  966.     long                             reservedH1;
  967.     long                             reservedH2;
  968.     MSAMIOCompletionUPP             ioCompletion;
  969.     OSErr                             ioResult;
  970.     long                             saveA5;
  971.     short                             reqCode;
  972.     MailMsgRef                         mailMsgRef;
  973.     MailSegmentMask                 segmentMask;
  974.     MailBuffer                         buffer;
  975.     StScrpRec *                        textScrap;
  976.     ScriptCode                         script;
  977.     MailSegmentType                 segmentType;
  978.     Boolean                         endOfScript;
  979.     Boolean                         endOfSegment;
  980.     Boolean                         endOfContent;
  981.     Boolean                         filler1;
  982.     long                             segmentLength;                /* NEW: <-  valid first call in a segment */
  983.     long                             segmentID;                    /* NEW: <-> identifier for this segment */
  984. };
  985. typedef struct MSAMGetContentPB MSAMGetContentPB;
  986.  
  987. struct MSAMGetEnclosurePB {
  988.     void *                            qLink;
  989.     long                             reservedH1;
  990.     long                             reservedH2;
  991.     MSAMIOCompletionUPP             ioCompletion;
  992.     OSErr                             ioResult;
  993.     long                             saveA5;
  994.     short                             reqCode;
  995.     MailMsgRef                         mailMsgRef;
  996.     Boolean                         contentEnclosure;
  997.     Byte                             padByte;
  998.     MailBuffer                         buffer;
  999.     Boolean                         endOfFile;
  1000.     Boolean                         endOfEnclosures;
  1001. };
  1002. typedef struct MSAMGetEnclosurePB MSAMGetEnclosurePB;
  1003.  
  1004. struct MailBlockInfo {
  1005.     OCECreatorType                     blockType;
  1006.     unsigned long                     offset;
  1007.     unsigned long                     blockLength;
  1008. };
  1009. typedef struct MailBlockInfo MailBlockInfo;
  1010.  
  1011. struct MSAMEnumerateBlocksPB {
  1012.     void *                            qLink;
  1013.     long                             reservedH1;
  1014.     long                             reservedH2;
  1015.     MSAMIOCompletionUPP             ioCompletion;
  1016.     OSErr                             ioResult;
  1017.     long                             saveA5;
  1018.     short                             reqCode;
  1019.     MailMsgRef                         mailMsgRef;
  1020.     unsigned short                     startIndex;                    /* starts at 1 */
  1021.     MailBuffer                         buffer;
  1022.                                                                 /*     buffer contains a Mail Reply. Each tuple is a MailBlockInfo */
  1023.     unsigned short                     nextIndex;
  1024.     Boolean                         more;
  1025.     Boolean                         filler1;
  1026. };
  1027. typedef struct MSAMEnumerateBlocksPB MSAMEnumerateBlocksPB;
  1028.  
  1029. struct MSAMGetBlockPB {
  1030.     void *                            qLink;
  1031.     long                             reservedH1;
  1032.     long                             reservedH2;
  1033.     MSAMIOCompletionUPP             ioCompletion;
  1034.     OSErr                             ioResult;
  1035.     long                             saveA5;
  1036.     short                             reqCode;
  1037.     MailMsgRef                         mailMsgRef;
  1038.     OCECreatorType                     blockType;
  1039.     unsigned short                     blockIndex;
  1040.     MailBuffer                         buffer;
  1041.     unsigned long                     dataOffset;
  1042.     Boolean                         endOfBlock;
  1043.     Byte                             padByte;
  1044.     unsigned long                     remaining;
  1045. };
  1046. typedef struct MSAMGetBlockPB MSAMGetBlockPB;
  1047.  
  1048. /*
  1049.  YOU SHOULD BE USING THE NEW FORM OF MARK RECIPIENTS
  1050.  * THIS VERSION IS MUCH SLOWER AND KEPT FOR COMPATIBILITY
  1051.  * REASONS.
  1052. */
  1053. /* not valid for tunnel form letters */
  1054. struct MSAMMarkRecipientsPB {
  1055.     void *                            qLink;
  1056.     long                             reservedH1;
  1057.     long                             reservedH2;
  1058.     MSAMIOCompletionUPP             ioCompletion;
  1059.     OSErr                             ioResult;
  1060.     long                             saveA5;
  1061.     short                             reqCode;
  1062.     MSAMQueueRef                     queueRef;
  1063.     long                             seqNum;
  1064.     MailBuffer                         buffer;                        /*     buffer contains a Mail Reply. Each tuple is an unsigned short, the index of a recipient to be marked. */
  1065.  
  1066. };
  1067. typedef struct MSAMMarkRecipientsPB MSAMMarkRecipientsPB;
  1068.  
  1069. /*
  1070.  * same as MSAMMarkRecipients except it takes a mailMsgRef instead of 
  1071.  * queueRef, seqNum 
  1072. */
  1073. /* not valid for tunnel form letters */
  1074. struct MSAMnMarkRecipientsPB {
  1075.     void *                            qLink;
  1076.     long                             reservedH1;
  1077.     long                             reservedH2;
  1078.     MSAMIOCompletionUPP             ioCompletion;
  1079.     OSErr                             ioResult;
  1080.     long                             saveA5;
  1081.     short                             reqCode;
  1082.     MailMsgRef                         mailMsgRef;
  1083.     MailBuffer                         buffer;                        /*     buffer contains a Mail Reply. Each tuple is an unsigned short, the index of a recipient to be marked. */
  1084.  
  1085. };
  1086. typedef struct MSAMnMarkRecipientsPB MSAMnMarkRecipientsPB;
  1087.  
  1088. /****************************************************************************************/
  1089. struct MSAMCreatePB {
  1090.     void *                            qLink;
  1091.     long                             reservedH1;
  1092.     long                             reservedH2;
  1093.     MSAMIOCompletionUPP             ioCompletion;
  1094.     OSErr                             ioResult;
  1095.     long                             saveA5;
  1096.     short                             reqCode;
  1097.     MSAMQueueRef                     queueRef;
  1098.     Boolean                         asLetter;                    /* indicate if we should create as letter or msg */
  1099.     Boolean                         filler1;
  1100.     IPMMsgType                         msgType;                    /* up to application discretion: must be of IPMSenderTag  kIPMOSFormatType for asLetter=true */
  1101.     long                             refCon;                        /* for messages only */
  1102.     long                             seqNum;                        /* set if creating message in the inQueue */
  1103.     Boolean                         tunnelForm;                    /* if true tunnelForm else newForm */
  1104.     Boolean                         bccRecipients;                /* true if creating letter with bcc recipients */
  1105.     MailMsgRef                         newRef;
  1106. };
  1107. typedef struct MSAMCreatePB MSAMCreatePB;
  1108.  
  1109. struct MSAMBeginNestedPB {
  1110.     void *                            qLink;
  1111.     long                             reservedH1;
  1112.     long                             reservedH2;
  1113.     MSAMIOCompletionUPP             ioCompletion;
  1114.     OSErr                             ioResult;
  1115.     long                             saveA5;
  1116.     short                             reqCode;
  1117.     MailMsgRef                         mailMsgRef;
  1118.     long                             refCon;                        /* for messages only */
  1119.     IPMMsgType                         msgType;
  1120. };
  1121. typedef struct MSAMBeginNestedPB MSAMBeginNestedPB;
  1122.  
  1123. struct MSAMEndNestedPB {
  1124.     void *                            qLink;
  1125.     long                             reservedH1;
  1126.     long                             reservedH2;
  1127.     MSAMIOCompletionUPP             ioCompletion;
  1128.     OSErr                             ioResult;
  1129.     long                             saveA5;
  1130.     short                             reqCode;
  1131.     MailMsgRef                         mailMsgRef;
  1132. };
  1133. typedef struct MSAMEndNestedPB MSAMEndNestedPB;
  1134.  
  1135. struct MSAMSubmitPB {
  1136.     void *                            qLink;
  1137.     long                             reservedH1;
  1138.     long                             reservedH2;
  1139.     MSAMIOCompletionUPP             ioCompletion;
  1140.     OSErr                             ioResult;
  1141.     long                             saveA5;
  1142.     short                             reqCode;
  1143.     MailMsgRef                         mailMsgRef;
  1144.     Boolean                         submitFlag;
  1145.     Byte                             padByte;
  1146.     MailLetterID                     msgID;
  1147. };
  1148. typedef struct MSAMSubmitPB MSAMSubmitPB;
  1149.  
  1150. struct MSAMPutMsgHeaderPB {
  1151.     void *                            qLink;
  1152.     long                             reservedH1;
  1153.     long                             reservedH2;
  1154.     MSAMIOCompletionUPP             ioCompletion;
  1155.     OSErr                             ioResult;
  1156.     long                             saveA5;
  1157.     short                             reqCode;
  1158.     MailMsgRef                         mailMsgRef;
  1159.     OCERecipient *                    replyQueue;
  1160.     IPMSender *                        sender;
  1161.     IPMNotificationType             deliveryNotification;
  1162.     IPMPriority                     priority;
  1163. };
  1164. typedef struct MSAMPutMsgHeaderPB MSAMPutMsgHeaderPB;
  1165.  
  1166. struct MSAMPutAttributePB {
  1167.     void *                            qLink;
  1168.     long                             reservedH1;
  1169.     long                             reservedH2;
  1170.     MSAMIOCompletionUPP             ioCompletion;
  1171.     OSErr                             ioResult;
  1172.     long                             saveA5;
  1173.     short                             reqCode;
  1174.     MailMsgRef                         mailMsgRef;
  1175.     MailAttributeID                 attrID;                        /* kMailIndicationsBit thru kMailSubjectBit */
  1176.     MailBuffer                         buffer;
  1177. };
  1178. typedef struct MSAMPutAttributePB MSAMPutAttributePB;
  1179.  
  1180. struct MSAMPutRecipientPB {
  1181.     void *                            qLink;
  1182.     long                             reservedH1;
  1183.     long                             reservedH2;
  1184.     MSAMIOCompletionUPP             ioCompletion;
  1185.     OSErr                             ioResult;
  1186.     long                             saveA5;
  1187.     short                             reqCode;
  1188.     MailMsgRef                         mailMsgRef;
  1189.     MailAttributeID                 attrID;                        /* kMailFromBit thru kMailBccBit */
  1190.     MailRecipient *                    recipient;
  1191.     Boolean                         responsible;                /* valid for server and message msams only */
  1192.     Boolean                         filler1;
  1193. };
  1194. typedef struct MSAMPutRecipientPB MSAMPutRecipientPB;
  1195.  
  1196. struct MSAMPutContentPB {
  1197.     void *                            qLink;
  1198.     long                             reservedH1;
  1199.     long                             reservedH2;
  1200.     MSAMIOCompletionUPP             ioCompletion;
  1201.     OSErr                             ioResult;
  1202.     long                             saveA5;
  1203.     short                             reqCode;
  1204.  
  1205.     MailMsgRef                         mailMsgRef;
  1206.     MailSegmentType                 segmentType;
  1207.     Boolean                         append;
  1208.     Byte                             padByte;
  1209.     MailBuffer                         buffer;
  1210.     StScrpRec *                        textScrap;
  1211.     Boolean                         startNewScript;
  1212.     Boolean                         filler1;
  1213.     ScriptCode                         script;                        /* valid only if startNewScript is true */
  1214. };
  1215. typedef struct MSAMPutContentPB MSAMPutContentPB;
  1216.  
  1217. struct MSAMPutEnclosurePB {
  1218.     void *                            qLink;
  1219.     long                             reservedH1;
  1220.     long                             reservedH2;
  1221.     MSAMIOCompletionUPP             ioCompletion;
  1222.     OSErr                             ioResult;
  1223.     long                             saveA5;
  1224.     short                             reqCode;
  1225.     MailMsgRef                         mailMsgRef;
  1226.     Boolean                         contentEnclosure;
  1227.     Byte                             padByte;
  1228.     Boolean                         hfs;                        /* true => in file system, false => in memory */
  1229.  
  1230.     Boolean                         append;
  1231.     MailBuffer                         buffer;                        /* Unused if hfs == true */
  1232.     FSSpec                             enclosure;
  1233.     MailEnclosureInfo                 addlInfo;
  1234. };
  1235. typedef struct MSAMPutEnclosurePB MSAMPutEnclosurePB;
  1236.  
  1237. struct MSAMPutBlockPB {
  1238.     void *                            qLink;
  1239.     long                             reservedH1;
  1240.     long                             reservedH2;
  1241.     MSAMIOCompletionUPP             ioCompletion;
  1242.     OSErr                             ioResult;
  1243.     long                             saveA5;
  1244.     short                             reqCode;
  1245.     MailMsgRef                         mailMsgRef;
  1246.     long                             refCon;                        /* for messages only */
  1247.     OCECreatorType                     blockType;
  1248.     Boolean                         append;
  1249.     Boolean                         filler1;
  1250.     MailBuffer                         buffer;
  1251.     MailBlockMode                     mode;                        /* if blockType is kMailTunnelLtrType or kMailHopInfoType  mode is assumed to be kMailFromMark */
  1252.     unsigned long                     offset;
  1253. };
  1254. typedef struct MSAMPutBlockPB MSAMPutBlockPB;
  1255.  
  1256. /****************************************************************************************/
  1257. struct MSAMCreateReportPB {
  1258.     void *                            qLink;
  1259.     long                             reservedH1;
  1260.     long                             reservedH2;
  1261.     MSAMIOCompletionUPP             ioCompletion;
  1262.     OSErr                             ioResult;
  1263.     long                             saveA5;
  1264.     short                             reqCode;
  1265.     MSAMQueueRef                     queueRef;                    /* to distinguish personal and server MSAMs */
  1266.     MailMsgRef                         mailMsgRef;
  1267.     MailLetterID                     msgID;                        /* kMailLetterIDBit of letter being reported upon */
  1268.     MailRecipient *                    sender;                        /* sender of the letter you are creating report on */
  1269. };
  1270. typedef struct MSAMCreateReportPB MSAMCreateReportPB;
  1271.  
  1272. struct MSAMPutRecipientReportPB {
  1273.     void *                            qLink;
  1274.     long                             reservedH1;
  1275.     long                             reservedH2;
  1276.     MSAMIOCompletionUPP             ioCompletion;
  1277.     OSErr                             ioResult;
  1278.     long                             saveA5;
  1279.     short                             reqCode;
  1280.     MailMsgRef                         mailMsgRef;
  1281.     short                             recipientIndex;                /* recipient index in the original letter */
  1282.     OSErr                             result;                        /* result of sending the recipient */
  1283. };
  1284. typedef struct MSAMPutRecipientReportPB MSAMPutRecipientReportPB;
  1285.  
  1286. /****************************************************************************************/
  1287. struct MailWakeupPMSAMPB {
  1288.     void *                            qLink;
  1289.     long                             reservedH1;
  1290.     long                             reservedH2;
  1291.     MSAMIOCompletionUPP             ioCompletion;
  1292.     OSErr                             ioResult;
  1293.     long                             saveA5;
  1294.     short                             reqCode;
  1295.     CreationID                         pmsamCID;
  1296.     MailSlotID                         mailSlotID;
  1297. };
  1298. typedef struct MailWakeupPMSAMPB MailWakeupPMSAMPB;
  1299.  
  1300. struct MailCreateMailSlotPB {
  1301.     void *                            qLink;
  1302.     long                             reservedH1;
  1303.     long                             reservedH2;
  1304.     MSAMIOCompletionUPP             ioCompletion;
  1305.     OSErr                             ioResult;
  1306.     long                             saveA5;
  1307.     short                             reqCode;
  1308.     MailboxRef                         mailboxRef;
  1309.     long                             timeout;
  1310.     CreationID                         pmsamCID;
  1311.     SMCA                             smca;
  1312. };
  1313. typedef struct MailCreateMailSlotPB MailCreateMailSlotPB;
  1314.  
  1315. struct MailModifyMailSlotPB {
  1316.     void *                            qLink;
  1317.     long                             reservedH1;
  1318.     long                             reservedH2;
  1319.     MSAMIOCompletionUPP             ioCompletion;
  1320.     OSErr                             ioResult;
  1321.     long                             saveA5;
  1322.     short                             reqCode;
  1323.     MailboxRef                         mailboxRef;
  1324.     long                             timeout;
  1325.     CreationID                         pmsamCID;
  1326.     SMCA                             smca;
  1327. };
  1328. typedef struct MailModifyMailSlotPB MailModifyMailSlotPB;
  1329.  
  1330. union MSAMParam {
  1331.     struct {
  1332.         void *                            qLink;
  1333.         long                             reservedH1;
  1334.         long                             reservedH2;
  1335.         MSAMIOCompletionUPP             ioCompletion;
  1336.         OSErr                             ioResult;
  1337.         long                             saveA5;
  1338.         short                             reqCode;
  1339.     }                                 header;
  1340.  
  1341.     PMSAMGetMSAMRecordPB             pmsamGetMSAMRecord;
  1342.     PMSAMOpenQueuesPB                 pmsamOpenQueues;
  1343.     PMSAMSetStatusPB                 pmsamSetStatus;
  1344.     PMSAMLogErrorPB                 pmsamLogError;
  1345.  
  1346.  
  1347.     SMSAMSetupPB                     smsamSetup;
  1348.     SMSAMStartupPB                     smsamStartup;
  1349.     SMSAMShutdownPB                 smsamShutdown;
  1350.  
  1351.     MSAMEnumeratePB                 msamEnumerate;
  1352.     MSAMDeletePB                     msamDelete;
  1353.  
  1354.     MSAMOpenPB                         msamOpen;
  1355.     MSAMOpenNestedPB                 msamOpenNested;
  1356.     MSAMClosePB                     msamClose;
  1357.     MSAMGetMsgHeaderPB                 msamGetMsgHeader;
  1358.     MSAMGetAttributesPB             msamGetAttributes;
  1359.     MSAMGetRecipientsPB             msamGetRecipients;
  1360.     MSAMGetContentPB                 msamGetContent;
  1361.     MSAMGetEnclosurePB                 msamGetEnclosure;
  1362.     MSAMEnumerateBlocksPB             msamEnumerateBlocks;
  1363.     MSAMGetBlockPB                     msamGetBlock;
  1364.     MSAMMarkRecipientsPB             msamMarkRecipients;
  1365.     MSAMnMarkRecipientsPB             msamnMarkRecipients;
  1366.  
  1367.     MSAMCreatePB                     msamCreate;
  1368.     MSAMBeginNestedPB                 msamBeginNested;
  1369.     MSAMEndNestedPB                 msamEndNested;
  1370.     MSAMSubmitPB                     msamSubmit;
  1371.     MSAMPutMsgHeaderPB                 msamPutMsgHeader;
  1372.     MSAMPutAttributePB                 msamPutAttribute;
  1373.     MSAMPutRecipientPB                 msamPutRecipient;
  1374.     MSAMPutContentPB                 msamPutContent;
  1375.     MSAMPutEnclosurePB                 msamPutEnclosure;            /* this field is SYSTEM8_DEPRECATED*/
  1376.     MSAMPutBlockPB                     msamPutBlock;
  1377.  
  1378.     MSAMCreateReportPB                 msamCreateReport;            /* Reports and Error Handling Calls */
  1379.     MSAMPutRecipientReportPB         msamPutRecipientReport;
  1380.  
  1381.     PMSAMCreateMsgSummaryPB         pmsamCreateMsgSummary;
  1382.     PMSAMPutMsgSummaryPB             pmsamPutMsgSummary;
  1383.     PMSAMGetMsgSummaryPB             pmsamGetMsgSummary;
  1384.  
  1385.     MailWakeupPMSAMPB                 wakeupPMSAM;
  1386.     MailCreateMailSlotPB             createMailSlot;
  1387.     MailModifyMailSlotPB             modifyMailSlot;
  1388. };
  1389. typedef union MSAMParam MSAMParam;
  1390.  
  1391.  
  1392. enum {
  1393.     uppMSAMIOCompletionProcInfo = kRegisterBased
  1394.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(MSAMParam *)))
  1395. };
  1396.  
  1397. #if GENERATINGCFM
  1398. #define CallMSAMIOCompletionProc(userRoutine, paramBlock)        \
  1399.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMSAMIOCompletionProcInfo, (paramBlock))
  1400. #else
  1401. /* (*MSAMIOCompletionUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  1402. #endif
  1403.  
  1404. #if GENERATINGCFM
  1405. #define NewMSAMIOCompletionProc(userRoutine)        \
  1406.         (MSAMIOCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMSAMIOCompletionProcInfo, GetCurrentArchitecture())
  1407. #else
  1408. #define NewMSAMIOCompletionProc(userRoutine)        \
  1409.         ((MSAMIOCompletionUPP) (userRoutine))
  1410. #endif
  1411. /* ASYNCHRONOUS ONLY, client must call WaitNextEvent */
  1412. extern pascal OSErr MailCreateMailSlot(MSAMParam *paramBlock)
  1413.  FIVEWORDINLINE(0x7001, 0x1F00, 0x3F3C, 0x052B, 0xAA5E);
  1414.  
  1415. /* ASYNCHRONOUS ONLY, client must call WaitNextEvent */
  1416. extern pascal OSErr MailModifyMailSlot(MSAMParam *paramBlock)
  1417.  FIVEWORDINLINE(0x7001, 0x1F00, 0x3F3C, 0x052C, 0xAA5E);
  1418.  
  1419. /* ASYNCHRONOUS ONLY, client must call WaitNextEvent */
  1420. extern pascal OSErr MailWakeupPMSAM(MSAMParam *paramBlock)
  1421.  FIVEWORDINLINE(0x7001, 0x1F00, 0x3F3C, 0x0507, 0xAA5E);
  1422.  
  1423. /* Personal MSAM Glue Routines */
  1424. extern pascal OSErr PMSAMOpenQueues(MSAMParam *paramBlock)
  1425.  FIVEWORDINLINE(0x7000, 0x1F00, 0x3F3C, 0x0500, 0xAA5E);
  1426.  
  1427. extern pascal OSErr PMSAMSetStatus(MSAMParam *paramBlock, Boolean asyncFlag)
  1428.  THREEWORDINLINE(0x3F3C, 0x0527, 0xAA5E);
  1429.  
  1430. /* SYNC ONLY */
  1431. extern pascal OSErr PMSAMGetMSAMRecord(MSAMParam *paramBlock)
  1432.  FIVEWORDINLINE(0x7000, 0x1F00, 0x3F3C, 0x0506, 0xAA5E);
  1433.  
  1434. /* Server MSAM Glue Routines */
  1435. /* SYNC ONLY */
  1436. extern pascal OSErr SMSAMSetup(MSAMParam *paramBlock)
  1437.  FIVEWORDINLINE(0x7000, 0x1F00, 0x3F3C, 0x0523, 0xAA5E);
  1438.  
  1439. /* SYNC ONLY */
  1440. extern pascal OSErr SMSAMStartup(MSAMParam *paramBlock)
  1441.  FIVEWORDINLINE(0x7000, 0x1F00, 0x3F3C, 0x0501, 0xAA5E);
  1442.  
  1443. extern pascal OSErr SMSAMShutdown(MSAMParam *paramBlock, Boolean asyncFlag)
  1444.  THREEWORDINLINE(0x3F3C, 0x0502, 0xAA5E);
  1445.  
  1446. /* Get Interface Glue Routines */
  1447. extern pascal OSErr MSAMEnumerate(MSAMParam *paramBlock, Boolean asyncFlag)
  1448.  THREEWORDINLINE(0x3F3C, 0x0503, 0xAA5E);
  1449.  
  1450. extern pascal OSErr MSAMDelete(MSAMParam *paramBlock, Boolean asyncFlag)
  1451.  THREEWORDINLINE(0x3F3C, 0x0504, 0xAA5E);
  1452.  
  1453. extern pascal OSErr MSAMMarkRecipients(MSAMParam *paramBlock, Boolean asyncFlag)
  1454.  THREEWORDINLINE(0x3F3C, 0x0505, 0xAA5E);
  1455.  
  1456. extern pascal OSErr MSAMnMarkRecipients(MSAMParam *paramBlock, Boolean asyncFlag)
  1457.  THREEWORDINLINE(0x3F3C, 0x0512, 0xAA5E);
  1458.  
  1459. extern pascal OSErr MSAMOpen(MSAMParam *paramBlock, Boolean asyncFlag)
  1460.  THREEWORDINLINE(0x3F3C, 0x0508, 0xAA5E);
  1461.  
  1462. extern pascal OSErr MSAMOpenNested(MSAMParam *paramBlock, Boolean asyncFlag)
  1463.  THREEWORDINLINE(0x3F3C, 0x0509, 0xAA5E);
  1464.  
  1465. extern pascal OSErr MSAMClose(MSAMParam *paramBlock, Boolean asyncFlag)
  1466.  THREEWORDINLINE(0x3F3C, 0x050A, 0xAA5E);
  1467.  
  1468. extern pascal OSErr MSAMGetRecipients(MSAMParam *paramBlock, Boolean asyncFlag)
  1469.  THREEWORDINLINE(0x3F3C, 0x050C, 0xAA5E);
  1470.  
  1471. extern pascal OSErr MSAMGetAttributes(MSAMParam *paramBlock, Boolean asyncFlag)
  1472.  THREEWORDINLINE(0x3F3C, 0x050B, 0xAA5E);
  1473.  
  1474. extern pascal OSErr MSAMGetContent(MSAMParam *paramBlock, Boolean asyncFlag)
  1475.  THREEWORDINLINE(0x3F3C, 0x050D, 0xAA5E);
  1476.  
  1477. extern pascal OSErr MSAMGetEnclosure(MSAMParam *paramBlock, Boolean asyncFlag)
  1478.  THREEWORDINLINE(0x3F3C, 0x050E, 0xAA5E);
  1479.  
  1480. extern pascal OSErr MSAMEnumerateBlocks(MSAMParam *paramBlock, Boolean asyncFlag)
  1481.  THREEWORDINLINE(0x3F3C, 0x050F, 0xAA5E);
  1482.  
  1483. extern pascal OSErr MSAMGetBlock(MSAMParam *paramBlock, Boolean asyncFlag)
  1484.  THREEWORDINLINE(0x3F3C, 0x0510, 0xAA5E);
  1485.  
  1486. extern pascal OSErr MSAMGetMsgHeader(MSAMParam *paramBlock, Boolean asyncFlag)
  1487.  THREEWORDINLINE(0x3F3C, 0x0511, 0xAA5E);
  1488.  
  1489. /* Put Interface Glue Routines */
  1490. extern pascal OSErr MSAMCreate(MSAMParam *paramBlock, Boolean asyncFlag)
  1491.  THREEWORDINLINE(0x3F3C, 0x0514, 0xAA5E);
  1492.  
  1493. extern pascal OSErr MSAMBeginNested(MSAMParam *paramBlock, Boolean asyncFlag)
  1494.  THREEWORDINLINE(0x3F3C, 0x0515, 0xAA5E);
  1495.  
  1496. extern pascal OSErr MSAMEndNested(MSAMParam *paramBlock)
  1497.  FIVEWORDINLINE(0x7000, 0x1F00, 0x3F3C, 0x0516, 0xAA5E);
  1498.  
  1499. /*  SYNCHRONOUS ONLY */
  1500. extern pascal OSErr MSAMSubmit(MSAMParam *paramBlock)
  1501.  FIVEWORDINLINE(0x7000, 0x1F00, 0x3F3C, 0x0517, 0xAA5E);
  1502.  
  1503. extern pascal OSErr MSAMPutAttribute(MSAMParam *paramBlock, Boolean asyncFlag)
  1504.  THREEWORDINLINE(0x3F3C, 0x0518, 0xAA5E);
  1505.  
  1506. extern pascal OSErr MSAMPutRecipient(MSAMParam *paramBlock, Boolean asyncFlag)
  1507.  THREEWORDINLINE(0x3F3C, 0x0519, 0xAA5E);
  1508.  
  1509. extern pascal OSErr MSAMPutContent(MSAMParam *paramBlock, Boolean asyncFlag)
  1510.  THREEWORDINLINE(0x3F3C, 0x051A, 0xAA5E);
  1511.  
  1512. /*  SYNCHRONOUS ONLY */
  1513. extern pascal OSErr MSAMPutEnclosure(MSAMParam *paramBlock)
  1514.  FIVEWORDINLINE(0x7000, 0x1F00, 0x3F3C, 0x051B, 0xAA5E);
  1515.  
  1516. extern pascal OSErr MSAMPutBlock(MSAMParam *paramBlock, Boolean asyncFlag)
  1517.  THREEWORDINLINE(0x3F3C, 0x051C, 0xAA5E);
  1518.  
  1519. extern pascal OSErr MSAMPutMsgHeader(MSAMParam *paramBlock, Boolean asyncFlag)
  1520.  THREEWORDINLINE(0x3F3C, 0x051D, 0xAA5E);
  1521.  
  1522. /* Reports and Error Handling Glue Routines */
  1523. extern pascal OSErr MSAMCreateReport(MSAMParam *paramBlock, Boolean asyncFlag)
  1524.  THREEWORDINLINE(0x3F3C, 0x051F, 0xAA5E);
  1525.  
  1526. extern pascal OSErr MSAMPutRecipientReport(MSAMParam *paramBlock, Boolean asyncFlag)
  1527.  THREEWORDINLINE(0x3F3C, 0x0520, 0xAA5E);
  1528.  
  1529. extern pascal OSErr PMSAMLogError(MSAMParam *paramBlock)
  1530.  FIVEWORDINLINE(0x7000, 0x1F00, 0x3F3C, 0x0521, 0xAA5E);
  1531.  
  1532. /* MsgSummary Glue Routines */
  1533. extern pascal OSErr PMSAMCreateMsgSummary(MSAMParam *paramBlock, Boolean asyncFlag)
  1534.  THREEWORDINLINE(0x3F3C, 0x0522, 0xAA5E);
  1535.  
  1536. extern pascal OSErr PMSAMPutMsgSummary(MSAMParam *paramBlock, Boolean asyncFlag)
  1537.  THREEWORDINLINE(0x3F3C, 0x0525, 0xAA5E);
  1538.  
  1539. extern pascal OSErr PMSAMGetMsgSummary(MSAMParam *paramBlock, Boolean asyncFlag)
  1540.  THREEWORDINLINE(0x3F3C, 0x0526, 0xAA5E);
  1541.  
  1542. #endif
  1543.  
  1544. #if PRAGMA_ALIGN_SUPPORTED
  1545. #pragma options align=reset
  1546. #endif
  1547.  
  1548. #if PRAGMA_IMPORT_SUPPORTED
  1549. #pragma import off
  1550. #endif
  1551.  
  1552. #ifdef __cplusplus
  1553. }
  1554. #endif
  1555.  
  1556. #endif /* __OCEMAIL__ */
  1557.  
  1558.